﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="SME.Food.Tricon.Web.AdminJS.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function setCookie() {
            document.cookie ="chd=ok;str=holle me";
           
        }
        function getCookieVal(offset) {
            var endstr = document.cookie.indexOf(";", offset);
            if (endstr == -1)
                endstr = document.cookie.length;
            return document.cookie.substring(offset, endstr);
        }
        function GetCookie(name) {
            var arg = name + "=";
            alert(arg);
            var clan = arg.length;
            if (document.cookie.length > 0)
            {
              var alen = document.cookie.indexOf(arg);
                alert(alen);
                    var j = alen;
                    if (document.cookie.substring(j-1, clan) == arg)
                        var a = getCookieVal(j);
                    alert(a);
                    $("#cookie", $("#form1")).val(a);
                    var b = $("#cookie", $("#form1")).val();                   
            }
            return null;
        }
    </script>
</head>
<body onload="setCookie()">
    <form id="form1" >
    <div>
      <input type="text" name="cookie" id="cookie" value="aa"/>
      <input type="button" name="" value="获取" onclick="GetCookie('chd')"/>
    </div>
    </form>
</body>
</html>
